﻿using OneDark.Update;
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace OneDark.Converters
{
    public class GitSource2Icon : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            GitProperty gitProperty = value as GitProperty;
            string strPath = "";
            switch (gitProperty.GitSource)
            {
                case RepoSource.GitHub:
                    strPath = "Resource/GitHub.png";
                    break;

                case RepoSource.Gitee:
                case RepoSource.Oschina:
                    strPath = "Resource/Gitee.png";
                    break;

                default:
                    break;
            }
            Uri uri = new Uri(strPath, UriKind.RelativeOrAbsolute);
            BitmapImage img = new BitmapImage(uri);
            return img;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}